package com.auto.learning.tools;

import java.io.File;

import android.content.Context;


public class FileOpUtils {

	
	/**
	 * copy file to disk
	 * @param tool
	 * @param fileName
	 */
	public static void copyFile2Local(FileCopeTool tool,String fileName) {
		String path = FileUtil.getFileCachePath();
		if (!tool.isfileExist(path,fileName)) {
			try {
				tool.copyOneFileToSDCard(fileName, path, fileName);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	
	
	public static void copyNecessaryFile(Context context,String fileName) {
		try {
			String wwwpath = FileUtil.getFileCachePath() + "/cache";
			FileCopeTool.deleteFolder(wwwpath);
			File file = new File(wwwpath);
			if (!file.exists()) {
				file.mkdirs();
			}
			FileCopeTool tool = new FileCopeTool(context);
			copyFile2Local(tool,fileName);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
